package hos.util.utils;

import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;

import hos.core.AppCompat;
import hos.util.compat.ResContext;
import hos.util.compat.StateListContext;


/**
 * <p>Title: StateListUtils </p>
 * <p>Description:  </p>
 * <p>Company: www.mapuni.com </p>
 *
 * @author : 蔡俊峰
 * @version : 1.0
 * @date : 2020/1/2 10:08
 */
public class StateListUtils {
    private static Context getContext() {
        return AppCompat.getApp();
    }
    // 设置不同状态时其文字颜色。

    public static ColorStateList createColorStateListRes(int color) {
        return StateListContext.createColorStateList(getContext(), color);
    }

    // 设置不同状态时其文字颜色。

    public static ColorStateList createColorStateListRes(int normal, int pressed) {
        return StateListContext.createColorStateList(getContext(), normal, pressed);
    }

    // 设置不同状态时其文字颜色。

    public static ColorStateList createColorStateListRes(int normal, int pressed, int unable) {
        return StateListContext.createColorStateList(getContext(), normal, pressed, unable);
    }

    // 设置不同状态时其文字颜色。

    public static ColorStateList createColorStateListRes(int normal, int pressed, int focused, int unable) {
        return StateListContext.createColorStateList(getContext(), normal, pressed, focused, unable);
    }

    // 设置不同状态时其文字颜色。

    public static ColorStateList createColorStateList(int normal, int pressed) {
        return StateListContext.createColorStateList(normal, pressed);
    }

    // 设置不同状态时其文字颜色。

    public static ColorStateList createColorStateList(int normal, int pressed, int unable) {
        return StateListContext.createColorStateList(normal, pressed, unable);
    }

    // 设置不同状态时其文字颜色。

    public static ColorStateList createColorStateList(int normal, int pressed, int focused, int unable) {
        return StateListContext.createColorStateList(normal, pressed, focused, unable);
    }

    /**
     * 设置Selector。
     */

    public static StateListDrawable createSelector(int idNormal, int idPressed, int idFocused,
                                                   int idUnable) {
        return StateListContext.createSelector(getContext(), idNormal, idPressed, idFocused, idUnable);
    }

    // 设置Selector

    public static StateListDrawable createSelector(Drawable normal, Drawable pressed, Drawable focused, Drawable unable) {
        return StateListContext.createSelector(normal, pressed, focused, unable);
    }
}
